
module.exports = function ($scope, $state, $stateParams,$resource,$modal,items,$modalInstance,FileUploader) {
    
    $resource('/api/as/ggc/reviewDistrictTourism/findByRecommend', {}, {}).save({'project_code':items.project_code}, function(res){
             console.log(res);

            if(res.errcode === 0){                      
                $scope.a = res.data;
                    console.log($scope.a);
                    //返回的字符串变成数组
                    $scope.array = $scope.a.project_file.split(',');
                    console.log($scope.array);
                    for(var i = 0;i<$scope.array.length;i++){
                        if($scope.array[i]==''){
                            $scope.array.splice(i,1);
                        }
                    }

                     if($scope.a.city_project=='0'){
                    $scope.a.city_project='区县项目'
                }
                if($scope.a.city_project=='1'){
                    $scope.a.city_project='市本级项目'
                }     
                 if($scope.a.recommend_type=='1'){
                    $scope.a.recommend_type='人事编制处'
                }
                 if($scope.a.recommend_type=='2'){
                    $scope.a.recommend_type='政策法规处'
                }   
                if($scope.a.recommend_type=='3'){
                    $scope.a.recommend_type='规划发展处'
                }  
                if($scope.a.recommend_type=='4'){
                    $scope.a.recommend_type='区域合作处'
                }  
                if($scope.a.recommend_type=='5'){
                    $scope.a.recommend_type='市场开发处'
                }  
                if($scope.a.recommend_type=='6'){
                    $scope.a.recommend_type='行业管理处'
                }  
                if($scope.a.recommend_type=='7'){
                    $scope.a.recommend_type='机关党委'
                }  
                if($scope.a.recommend_type=='8'){
                    $scope.a.recommend_type='质监所'
                }  
                if($scope.a.recommend_type=='9'){
                    $scope.a.recommend_type='发展中心'
                }  
                if($scope.a.recommend_type=='10'){
                    $scope.a.recommend_type='培训中心'
                }  
                if($scope.a.recommend_type=='11'){
                    $scope.a.recommend_type='协会秘书处'
                }                   
            }else{
                alert(res.errmsg);
            }
        });
    
    $scope.info={'photo':''};
    $scope.applyarr=[
    {name:'区县项目',value:'0'},
    {name:'市级项目',value:'1'},
]   

     $resource('/api/as/ggc/reviewGuide/findInfoTypeList', {}, {}).save({}, function(res){
            // console.log(res);
            if(res.errcode === 0){                      
                // console.log(res);
                // console.log('上面是res');
                $scope.ntarr=[];
                for(var i =0;i<res.data.length;i++){
                    $scope.ntarr.push({name:i,value:res.data[i].guide_type});
                }
                console.log($scope.ntarr);
            }else{
                alert(res.errmsg);
            }
        });
        $scope.del=function(index){
            $scope.array.splice(index,1);
            $scope.a.project_file=$scope.array;
        }
            $scope.image = function(){
				var para = $state.get('app.imageupload');
				//设置上传文件夹，以自己业务命名
				angular.extend(para, {
					resolve : {  
						'dir' : function(){
							return 't1';
						}
					} 
				})
				console.log(para);
				var modalInstance = $modal.open(para);
				modalInstance.opened.then(function() {// 模态窗口打开之后执行的函数  
					console.log('modal is opened');  
				});  
				modalInstance.result.then(function(result) {  
					console.log(result);  
					$scope.imagearr = JSON.stringify(result);
					// console.log(scope.imagearr);
					$scope.array = result;
                    $scope.a.project_file=$scope.array;
					// $scope.a.project_file = array[0];
					// console.log(scope.info.img);
					// form.result['templete_lock_data_json'] = JSON.stringify(result.lock);
					// form.result['templete_check_data_json'] = result.unlock;

				}, function(reason) {  
					console.log(reason);// 点击空白区域，总会输出backdrop  
					// click，点击取消，则会暑促cancel  
					$log.info('Modal dismissed at: ' + new Date());  
				}); 
			};    



$scope.close = function(){

$modalInstance.close();
  
}
};
